﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="lp_ForSale.aspx.cs" Inherits="ZLDC.Estate.Quantify.Report.lp_ForSale" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="../../js/jquery/jquery-1.3.2.js" type="text/javascript"></script>

    <link href="../../css/main1.css" rel="stylesheet" type="text/css" />

    <script src="../charts/FusionCharts.js" type="text/javascript"></script>

    <script src="../charts/highcharts1.js" type="text/javascript"></script>

    <script src="../js/GetUrl.js" type="text/javascript"></script>

    <script src="../../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

    <style type="text/css">
        .table1
        {
            width: 99%;
            text-align: center;
            margin-top: 5px;
            margin-left: 5px;
            margin-right: 5px;
        }
        tr
        {
        }
        .tdtop
        {
            text-align: center;
            background-color: #d3eaef;
            width: 50%;
        }
    </style>

    <script type="text/javascript">
       
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce' class="table1"
            valign='top'>
            <tr>
                <td class="tdtop">
                   带看售房<span id="span1"></span><br />
                   <table width="500px">
                        <tr>
                            <td style="">
                                日期:
                                <input id="Text3" type="text" runat="server" class="txtbox" onclick="WdatePicker()" />~
                                <input id="Text4" type="text" runat="server" class="txtbox" onclick="WdatePicker()" />
                                <input id="Radio1" name="rd2" type="radio" checked="checked" value="楼盘" />楼盘
                                <input id="Radio2" name="rd2" type="radio" value="价格" />价格
                                <input id="Radio3" name="rd2" type="radio" value="面积" />面积
                            </td>
                            <td rowspan="2">
                                <input id="Button2" type="button" value="查询"  onclick="exelList(2)" />
                            </td>
                        </tr>
                    </table>
                </td>
                <td class="tdtop">
                    带看租房<span id="span2"></span><br />
                    
                     <table width="500px">
                        <tr>
                            <td>
                                日期:
                                <input id="Text1" type="text" runat="server" class="txtbox" onclick="WdatePicker()" />~
                                <input id="Text2" runat="server" type="text" class="txtbox" onclick="WdatePicker()" />
                                <input id="radhousing1" name="rd1" type="radio" checked="checked" value="楼盘" />楼盘
                                <input id="radhousing2" name="rd1" type="radio" value="价格" />价格
                                <input id="radhousing3" name="rd1" type="radio" value="面积" />面积
                            </td>
                            <td rowspan="2">
                                <input id="Button1" type="button" value="查询" onclick="exelList(1)" />

                                <script type="text/javascript">

                                    function exelList(obj) {
                                    
                                        switch (obj) {
                                            case 1:
                                                var rd1value = '';
                                                var temp = document.getElementsByName("rd1");
                                                for (i = 0; i < temp.length; i++) {

                                                    //遍历Radio

                                                    if (temp[i].checked) {
                                                        rd1value = temp[i].value;
                                                    }
                                                }
                                                
                                                if (rd1value == '楼盘') {
                                                    ForSalelist(currentPage1);
                                                }
                                                if (rd1value == '价格') {
                                                    SalePrice('带看租房', rd1value,1);
                                                }
                                                if (rd1value == '面积') {
                                                    SaleArea('带看租房', rd1value, 1);
                                                }
                                                break;
                                            case 2:
                                                var rd1value = '';
                                                var temp = document.getElementsByName("rd2");
                                                for (i = 0; i < temp.length; i++) {

                                                    //遍历Radio

                                                    if (temp[i].checked) {
                                                        rd1value = temp[i].value;
                                                    }
                                                }

                                                if (rd1value == '楼盘') {
                                                    Rentlist(currentPage2);
                                                }
                                                if (rd1value == '价格') {
                                                    SalePrice('带看售房', rd1value,2);
                                                }
                                                if (rd1value == '面积') {
                                                    SaleArea('带看售房', rd1value, 2);
                                                }
                                                
                                                break;
                                        }

                                    }
                                    
                                    //价格
                                    function SalePrice(type, rd1value, obj) {
                                    
                                        var adddate1 = '';
                                        var adddate2 ='';
                                        if (obj == 1) {
                                            adddate1 = document.getElementById('Text1').value;
                                            adddate2 = document.getElementById('Text2').value;
                                        }
                                        else {
                                            adddate1 = document.getElementById('Text3').value;
                                            adddate2 = document.getElementById('Text4').value;
                                        }
                                        if (type == '带看租房') {
                                            datawhere = "&type=" + escape(type) + "&page=" + currentPage1 + "&pagesize=" + pageSize1 + "";
                                        }
                                        else {
                                            datawhere = "&type=" + escape(type) + "&page=" + currentPage2 + "&pagesize=" + pageSize2 + "";
                                        }
                                        document.getElementById('divtd'+obj+'').innerHTML = "<div><img src=\"../../images/loading.gif\" /></div>";
                                        $.ajax({
                                            type: "POST",
                                            url: "../AjaxServer.aspx",
                                            dataType: 'json',
                                            data: "alt=SalePrice&rdvalue=" + escape(rd1value) + "&deptid=" + deptid + "&startTime=" + escape(adddate1) + "&EndTime=" + escape(adddate2) + "" + datawhere + "",
                                            processData: false,
                                            timeout: '10000',
                                            success: function(json) {
                                                divcountsale(json,obj);
                                            },
                                            error: function() {
                                                document.getElementById('divtd'+obj+'').innerHTML = "系统繁忙";
                                            }

                                        });
                                    }

                                    function divcountsale(response,obj) {
                                        //var json = eval("(" + response + ")");
                                        var json = response;
                                        var record = json.record;
                                        var page = json.page;
                                        if (record == null || record.length == 0) {
                                            $("#divtd"+obj+"").html("<font color='red'>&nbsp;系统内暂无您查询的信息!</font>");
                                            return;
                                        }
                                        $("#divtd" + obj + "").html(""); // 显示列表
                                        var arr = [];
                                        arr.push("<table  border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce' class=\"table1\" valign='top' >");
                                        arr.push("<tr bgcolor=\"#353c44\" >");
                                        arr.push("<td   style='text-align: center;background-color: #d3eaef;width:100px;'  >");
                                        arr.push("<div >" + page.rdvalue + "</div>");
                                        arr.push("</td>");
                                        arr.push("<td   style='text-align: center;background-color: #d3eaef;width:60px'>");
                                        arr.push("<div >查看次数</div>");
                                        arr.push("</td>");
                                        arr.push("</tr>");
                                        for (var i = 0; i < record.length; i++) {

                                            if (i % 2 == 0)
                                                arr.push("<tr bgcolor='#FFFFFF'>");
                                            else
                                                arr.push("<tr bgcolor='#EEEDED'>");
                                            arr.push("<td height='20' class='STYLE6'  style='text-align: center;'>");
                                            arr.push("<a onclick=\"allcount('" + record[i].价格 + "','" + page.ftype + "',"+obj+")\">" + record[i].价格 + "</a>");
                                            arr.push("</td>");
                                            arr.push("<td height='20' class='STYLE6'>");
                                            arr.push(record[i].count);
                                            arr.push("</td>");

                                            arr.push("</tr>");
                                        }
                                        arr.push("</table>");
                                        document.getElementById('divtd'+obj+'').innerHTML = arr.join('');
                                    }

                                    function allcount(sale, ftype,obj) {//2为售 1未租
                                    
                                        var adddate1 = '';
                                        var adddate2 = '';
                                        if (obj == 1) {
                                            adddate1 = document.getElementById('Text1').value;
                                            adddate2 = document.getElementById('Text1').value;
                                        }
                                        else {
                                            adddate1 = document.getElementById('Text3').value;
                                            adddate2 = document.getElementById('Text3').value;
                                        }
                                        var path = "&deptid=" + deptid + "&addDate2=" + escape(adddate2) + "" + "&addDate1=" + escape(adddate1) + "&sale="+sale+"";
                                        var typeName = "../../AM/CustomerFollowList.aspx?ftype=" + ftype + "" + path + "";

                                        self.parent.closeTab(sale + '' + ftype);
                                        self.parent.addTab(sale + '' + ftype, typeName, 'icon-nav');
                                    }
                                    
                                    
                                    //面积
                                    function SaleArea(type, rd1value, obj) {
                                        var adddate1 = '';
                                        var adddate2 = '';
                                        if (obj == 1) {
                                            adddate1 = document.getElementById('Text1').value;
                                            adddate2 = document.getElementById('Text2').value;
                                        }
                                        else {
                                            adddate1 = document.getElementById('Text3').value;
                                            adddate2 = document.getElementById('Text4').value;
                                        }
                                        if (type == '带看租房') {
                                            datawhere = "&type=" + escape(type) + "&page=" + currentPage1 + "&pagesize=" + pageSize1 + "";
                                        }
                                        else {
                                            datawhere = "&type=" + escape(type) + "&page=" + currentPage2 + "&pagesize=" + pageSize2 + "";
                                        }
                                        document.getElementById('divtd' + obj + '').innerHTML = "<div><img src=\"../../images/loading.gif\" /></div>";
                                        $.ajax({
                                            type: "POST",
                                            url: "../AjaxServer.aspx",
                                            dataType: 'json',
                                            data: "alt=SaleArea&rdvalue=" + escape(rd1value) + "&deptid=" + deptid + "&startTime=" + escape(adddate1) + "&EndTime=" + escape(adddate2) + "" + datawhere + "",
                                            processData: false,
                                            timeout: '10000',
                                            success: function(json) {
                                                divArea(json, obj);
                                            },
                                            error: function() {
                                                document.getElementById('divtd'+obj+'').innerHTML = "系统繁忙";
                                            }

                                        });
                                    }

                                    function divArea(response, obj) {
                                        //var json = eval("(" + response + ")");
                                        var json = response;
                                        var record = json.record;
                                        var page = json.page;
                                        if (record == null || record.length == 0) {
                                            $("#divtd" + obj + "").html("<font color='red'>&nbsp;系统内暂无您查询的信息!</font>");
                                            return;
                                        }
                                        $("#divtd" + obj + "").html(""); // 显示列表
                                        var arr = [];
                                        arr.push("<table  border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce' class=\"table1\" valign='top' >");
                                        arr.push("<tr bgcolor=\"#353c44\" >");
                                        arr.push("<td   style='text-align: center;background-color: #d3eaef;width:100px;'  >");
                                        arr.push("<div >" + page.rdvalue + "</div>");
                                        arr.push("</td>");
                                        arr.push("<td   style='text-align: center;background-color: #d3eaef;width:60px'>");
                                        arr.push("<div >查看次数</div>");
                                        arr.push("</td>");
                                        arr.push("</tr>");
                                        for (var i = 0; i < record.length; i++) {

                                            if (i % 2 == 0)
                                                arr.push("<tr bgcolor='#FFFFFF'>");
                                            else
                                                arr.push("<tr bgcolor='#EEEDED'>");
                                            arr.push("<td height='20' class='STYLE6'  style='text-align: center;'>");
                                            arr.push("<a onclick=\"allArea('" + record[i].面积 + "','" + page.ftype + "'," + obj + ")\">" + record[i].面积 + "</a>");
                                            arr.push("</td>");
                                            arr.push("<td height='20' class='STYLE6'>");
                                            arr.push(record[i].count);
                                            arr.push("</td>");

                                            arr.push("</tr>");
                                        }
                                        arr.push("</table>");
                                        document.getElementById('divtd' + obj + '').innerHTML = arr.join('');
                                    }

                                    function allArea(sale, ftype, obj) {//2为售 1未租

                                        var adddate1 = '';
                                        var adddate2 = '';
                                        if (obj == 1) {
                                            adddate1 = document.getElementById('Text1').value;
                                            adddate2 = document.getElementById('Text1').value;
                                        }
                                        else {
                                            adddate1 = document.getElementById('Text3').value;
                                            adddate2 = document.getElementById('Text3').value;
                                        }
                                        var path = "&deptid=" + deptid + "&addDate2=" + escape(adddate2) + "" + "&addDate1=" + escape(adddate1) + "&sale=" + sale + "";
                                        var typeName = "../../AM/CustomerFollowList.aspx?ftype=" + ftype + "" + path + "";

                                        self.parent.closeTab(sale + '' + ftype);
                                        self.parent.addTab(sale + '' + ftype, typeName, 'icon-nav');
                                    }
                                </script>

                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            
            <tr>
               
                <td valign="top">
                    <div id="divtd2" style="">
                    </div>
                    <div id="divPage2">
                    </div>
                </td> 
                <td valign="top">
                    <div id="divtd1" style="">
                    </div>
                    <div id="divPage1">
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <input id="hiddeptid" type="hidden" runat="server" />
<input id="hidftype" type="hidden" runat="server" />
<input id="hiddepttype" type="hidden" runat="server" />
    <script src="js/lp_ForSale.js" type="text/javascript"></script>
    <script src="../../js/LexunJS.js" type="text/javascript"></script>

    </form>
</body>
</html>
